/**
 * 对象是否为空
 * @param object
 * @returns {boolean}
 */
function isEmpty(object) {
  if (object === null || object === '' || object === undefined) {
    return true
  }
  return false
}


/**处理深化的规则*/
export function dealFARule(detailList, projectInfo) {

  if (detailList == null) {
    return
  }

  //计算所有的用地强度
  for (let i = 0; i < detailList.length; i++) {
    //为空不判断
    if (isEmpty(detailList[i].fangAnJieDuan) && detailList[i].targetItem.writeFaType != 2) {
      detailList[i].fangAnJieDuanStatus = 0;
      continue
    }


    // if (
    //   detailList[i].targetItem.checkTargetShRule == 3
    //   || detailList[i].targetItem.checkTargetShRule == 6
    //   || detailList[i].targetItem.checkTargetShRule == 10
    // ) {//这些规则需要等待两个框都填写
    //   if (isEmpty(detailList[i].fangAnJieDuan)
    //     || isEmpty(detailList[i].shiGongJieDuan)) {
    //     detailList[i].fangAnJieDuanStatus = 0;
    //     detailList[i].shiGongJieDuanStatus = 0;
    //     continue;
    //   }
    // }

    if (detailList[i].targetItem.checkTargetFaRule == 0) {//不计算
      detailList[i].fangAnJieDuanStatus = 0;
      continue;
    } else if (detailList[i].targetItem.checkTargetFaRule == 1) {//小余等于
      if (Number(detailList[i].fangAnJieDuan)
        <= Number(detailList[i].targetItem.checkTargetRuleFaValue)) {
        detailList[i].fangAnJieDuanStatus = 0;
      } else {
        detailList[i].fangAnJieDuanStatus = 1;
      }
      if (Number(detailList[i].shiCeJieDuan)
        <= Number(detailList[i].targetItem.checkTargetRuleFaValue)) {
        detailList[i].shiCeJieDuanStatus = 0;
      } else {
        detailList[i].shiCeJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetFaRule == 2) {//小余
      if (Number(detailList[i].fangAnJieDuan)
        < Number(detailList[i].targetItem.checkTargetRuleFaValue)) {
        detailList[i].fangAnJieDuanStatus = 0;
      } else {
        detailList[i].fangAnJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetFaRule == 3) {//相同
      // console.log(detailList[i].targetItem.title3 + "   " + Number(detailList[i].fangAnJieDuan) + "   " + Number(detailList[i].targetItem.checkTargetRuleFaValue));
      if (Number(detailList[i].fangAnJieDuan)
        === Number(detailList[i].targetItem.checkTargetRuleFaValue)) {
        detailList[i].fangAnJieDuanStatus = 0;
      } else {
        detailList[i].fangAnJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetFaRule == 4) {//大于
      if (Number(detailList[i].fangAnJieDuan)
        > Number(detailList[i].targetItem.checkTargetRuleFaValue)) {
        detailList[i].fangAnJieDuanStatus = 0;
      } else {
        detailList[i].fangAnJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetFaRule == 5) {//大于等于
      if (Number(detailList[i].fangAnJieDuan)
        >= Number(detailList[i].targetItem.checkTargetRuleFaValue)) {
        detailList[i].fangAnJieDuanStatus = 0;
      } else {
        detailList[i].fangAnJieDuanStatus = 1;
      }
    }
    // else if (detailList[i].targetItem.checkTargetSgRule == 10) {//单纯百分比正偏差 正偏差=（（施工图阶段-方案阶段）/方案阶段）<x%并且 施工图阶段-方案阶段>=0
    //   if (!isEmpty(detailList[i].fangAnJieDuan)) {
    //     let piancha = ((detailList[i].shiGongJieDuan - Number(detailList[i].fangAnJieDuan))
    //       / Number(detailList[i].fangAnJieDuan));
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleSgValue)
    //       &&
    //       detailList[i].shiGongJieDuan - Number(detailList[i].fangAnJieDuan) >= 0) {
    //
    //       detailList[i].fangAnJieDuanStatus = 0;
    //     } else {
    //       detailList[i].fangAnJieDuanStatus = 1;
    //     }
    //   }
    // }
    else if (detailList[i].targetItem.checkTargetFaRule == 11) {//范围值
      // 先提取范围
      let value = detailList[i].targetItem.checkTargetRuleFaValue;
      let valueArr = value.split("-");
      let value1 = valueArr[0], value2 = valueArr[1];

      if (Number(detailList[i].fangAnJieDuan)
        >= value1
        && Number(detailList[i].fangAnJieDuan)
        <= value2) {
        detailList[i].fangAnJieDuanStatus = 0;
      } else {
        detailList[i].fangAnJieDuanStatus = 1;
      }
    }
    // else if (detailList[i].targetItem.checkTargetSgRule == 12) {//百分比偏差=（（施工图阶段-方案阶段）/方案阶段） 施工图阶段可以小于方案阶段的值
    //
    //   if (!isEmpty(Number(detailList[i].fangAnJieDuan))) {
    //     let piancha = ((detailList[i].shiGongJieDuan - Number(detailList[i].fangAnJieDuan))
    //       / Number(detailList[i].fangAnJieDuan)).toFixed(8);
    //     piancha = Math.abs(piancha)
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleFaValue)
    //     ) {
    //
    //       detailList[i].fangAnJieDuanStatus = 0;
    //     } else {
    //       detailList[i].fangAnJieDuanStatus = 1;
    //     }
    //   }
    // } else if (detailList[i].targetItem.checkTargetSgRule == 13) {//值偏差=（（施工图阶段-方案阶段）<x） 施工图阶段可以小于方案阶段的值
    //
    //   if (!isEmpty(detailList[i].fangAnJieDuan)) {
    //     let piancha = (detailList[i].shiGongJieDuan - Number(detailList[i].fangAnJieDuan))
    //     piancha = Math.abs(piancha)
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleFaValue)
    //     ) {
    //
    //       detailList[i].fangAnJieDuanStatus = 0;
    //     } else {
    //       detailList[i].fangAnJieDuanStatus = 1;
    //     }
    //   }
    // } else if (detailList[i].targetItem.checkTargetFaRule == 14
    //   && detailList[i].targetItem.checkTargetSgRule == 14) {//值负偏差 ： 偏差值=（（（施工图阶段-方案阶段）/方案阶段）） 并且  施工图阶段可以小于方案阶段的值,但是施工大于方案的话偏差不能超过x%
    //   if (!isEmpty(detailList[i].fangAnJieDuan)) {
    //     let piancha = (detailList[i].shiGongJieDuan - Number(detailList[i].fangAnJieDuan)) / Number(detailList[i].fangAnJieDuan)
    //     console.log(piancha)
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleSgValue)
    //     ) {
    //       detailList[i].shiGongJieDuanStatus = 0;
    //     } else {
    //       detailList[i].shiGongJieDuanStatus = 1;
    //     }
    //   }
    // }
    else if (detailList[i].targetItem.checkTargetFaRule == 100) {//直接执行语句
      // if (detailList[i].targetItem.title3.indexOf("住宅标准层含钢量指标H≤24m") >= 0) {
      //替换信息
      let grammar = detailList[i].targetItem.calculateFaGrammar;
      if (isEmpty(grammar)) {
        continue
      }
      if (grammar.indexOf("hintError") >= 0) {
        detailList[i].hintError = "";
      }

      grammar = grammar.replaceAll("targetItem[.]", "detailList[i].targetItem.");
      // grammar = grammar.replaceAll("projectInfo[.]", "projectInfo.");
      // grammar = grammar.replace(/progressItem./g, "");
      grammar = grammar.replaceAll("hintError", "detailList[i].hintError");
      grammar = grammar.replaceAll("detail[.]", "detailList[i].");

      //创建接收的值
      //计算方案阶段的
      let grammar1 = grammar.replaceAll("input", "Number(detailList[i].fangAnJieDuan)");
      grammar1 = grammar1.replaceAll("status", "detailList[i].fangAnJieDuanStatus");

      // console.log(grammar1)
      if (!isEmpty(detailList[i].fangAnJieDuan) || detailList[i].targetItem.writeFaType === 2) {
        eval(grammar1);
      }
      // }
    }
    // //为空不判断
    // if (
    //   detailList[i].targetItem.checkTargetFaRule == 3
    //   || detailList[i].targetItem.checkTargetFaRule == 6
    //   || detailList[i].targetItem.checkTargetFaRule == 10
    // ) {//这些规则需要等待两个框都填写
    // } else {//需要单独判断的填框，如果为空的话则不设置状态
    //   if (isEmpty(detailList[i].fangAnJieDuan)) {
    //     detailList[i].fangAnJieDuanStatus = 0;
    //   }
    // }

  }
}

/**处理深化的规则*/
export function dealSHRule(detailList, projectInfo) {

  if (detailList == null) {
    return
  }

  //计算所有的用地强度
  for (let i = 0; i < detailList.length; i++) {
    //为空不判断
    if (isEmpty(detailList[i].shenHuaJieDuan) && detailList[i].targetItem.writeShType != 2) {
      detailList[i].shenHuaJieDuanStatus = 0;
      continue
    }


    // if (
    //   detailList[i].targetItem.checkTargetShRule == 3
    //   || detailList[i].targetItem.checkTargetShRule == 6
    //   || detailList[i].targetItem.checkTargetShRule == 10
    // ) {//这些规则需要等待两个框都填写
    //   if (isEmpty(detailList[i].shenHuaJieDuan)
    //     || isEmpty(detailList[i].shiGongJieDuan)) {
    //     detailList[i].shenHuaJieDuanStatus = 0;
    //     detailList[i].shiGongJieDuanStatus = 0;
    //     continue;
    //   }
    // }

    if (detailList[i].targetItem.checkTargetShRule == 0) {//不计算
      detailList[i].shenHuaJieDuanStatus = 0;
      continue;
    } else if (detailList[i].targetItem.checkTargetShRule == 1) {//小余等于
      if (Number(detailList[i].shenHuaJieDuan)
        <= Number(detailList[i].targetItem.checkTargetRuleShValue)) {
        detailList[i].shenHuaJieDuanStatus = 0;
      } else {
        detailList[i].shenHuaJieDuanStatus = 1;
      }
      if (Number(detailList[i].shiCeJieDuan)
        <= Number(detailList[i].targetItem.checkTargetRuleShValue)) {
        detailList[i].shiCeJieDuanStatus = 0;
      } else {
        detailList[i].shiCeJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetShRule == 2) {//小余
      if (Number(detailList[i].shenHuaJieDuan)
        < Number(detailList[i].targetItem.checkTargetRuleShValue)) {
        detailList[i].shenHuaJieDuanStatus = 0;
      } else {
        detailList[i].shenHuaJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetShRule == 3) {//相同
      console.log(detailList[i].targetItem.title3 + "   " + Number(detailList[i].shenHuaJieDuan) + "   " + Number(detailList[i].targetItem.checkTargetRuleShValue));
      if (Number(detailList[i].shenHuaJieDuan)
        === Number(detailList[i].targetItem.checkTargetRuleShValue)) {
        detailList[i].shenHuaJieDuanStatus = 0;
      } else {
        detailList[i].shenHuaJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetShRule == 4) {//大于
      if (Number(detailList[i].shenHuaJieDuan)
        > Number(detailList[i].targetItem.checkTargetRuleShValue)) {
        detailList[i].shenHuaJieDuanStatus = 0;
      } else {
        detailList[i].shenHuaJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetShRule == 5) {//大于等于
      if (Number(detailList[i].shenHuaJieDuan)
        >= Number(detailList[i].targetItem.checkTargetRuleShValue)) {
        detailList[i].shenHuaJieDuanStatus = 0;
      } else {
        detailList[i].shenHuaJieDuanStatus = 1;
      }
    }
    // else if (detailList[i].targetItem.checkTargetSgRule == 10) {//单纯百分比正偏差 正偏差=（（施工图阶段-方案阶段）/方案阶段）<x%并且 施工图阶段-方案阶段>=0
    //   if (!isEmpty(detailList[i].shenHuaJieDuan)) {
    //     let piancha = ((detailList[i].shiGongJieDuan - Number(detailList[i].shenHuaJieDuan))
    //       / Number(detailList[i].shenHuaJieDuan));
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleSgValue)
    //       &&
    //       detailList[i].shiGongJieDuan - Number(detailList[i].shenHuaJieDuan) >= 0) {
    //
    //       detailList[i].shenHuaJieDuanStatus = 0;
    //     } else {
    //       detailList[i].shenHuaJieDuanStatus = 1;
    //     }
    //   }
    // }
    else if (detailList[i].targetItem.checkTargetShRule == 11) {//范围值
      // 先提取范围
      let value = detailList[i].targetItem.checkTargetRuleShValue;
      let valueArr = value.split("-");
      let value1 = valueArr[0], value2 = valueArr[1];

      if (Number(detailList[i].shenHuaJieDuan)
        >= value1
        && Number(detailList[i].shenHuaJieDuan)
        <= value2) {
        detailList[i].shenHuaJieDuanStatus = 0;
      } else {
        detailList[i].shenHuaJieDuanStatus = 1;
      }
    }
    // else if (detailList[i].targetItem.checkTargetSgRule == 12) {//百分比偏差=（（施工图阶段-方案阶段）/方案阶段） 施工图阶段可以小于方案阶段的值
    //
    //   if (!isEmpty(detailList[i].shenHuaJieDuan)) {
    //     let piancha = ((detailList[i].shiGongJieDuan - Number(detailList[i].shenHuaJieDuan))
    //       / Number(detailList[i].shenHuaJieDuan)).toFixed(8);
    //     piancha = Math.abs(piancha)
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleShValue)
    //     ) {
    //
    //       detailList[i].shenHuaJieDuanStatus = 0;
    //     } else {
    //       detailList[i].shenHuaJieDuanStatus = 1;
    //     }
    //   }
    // } else if (detailList[i].targetItem.checkTargetSgRule == 13) {//值偏差=（（施工图阶段-方案阶段）<x） 施工图阶段可以小于方案阶段的值
    //
    //   if (!isEmpty(detailList[i].shenHuaJieDuan)) {
    //     let piancha = (detailList[i].shiGongJieDuan - Number(detailList[i].shenHuaJieDuan))
    //     piancha = Math.abs(piancha)
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleShValue)
    //     ) {
    //
    //       detailList[i].shenHuaJieDuanStatus = 0;
    //     } else {
    //       detailList[i].shenHuaJieDuanStatus = 1;
    //     }
    //   }
    // } else if (detailList[i].targetItem.checkTargetShRule == 14
    //   && detailList[i].targetItem.checkTargetSgRule == 14) {//值负偏差 ： 偏差值=（（（施工图阶段-方案阶段）/方案阶段）） 并且  施工图阶段可以小于方案阶段的值,但是施工大于方案的话偏差不能超过x%
    //   if (!isEmpty(detailList[i].shenHuaJieDuan)) {
    //     let piancha = (detailList[i].shiGongJieDuan - Number(detailList[i].shenHuaJieDuan)) / Number(detailList[i].shenHuaJieDuan)
    //     console.log(piancha)
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleSgValue)
    //     ) {
    //       detailList[i].shiGongJieDuanStatus = 0;
    //     } else {
    //       detailList[i].shiGongJieDuanStatus = 1;
    //     }
    //   }
    // }
    else if (detailList[i].targetItem.checkTargetShRule == 100) {//直接执行语句
      // if (detailList[i].targetItem.title3.indexOf("住宅标准层含钢量指标H≤24m") >= 0) {
      //替换信息
      let grammar = detailList[i].targetItem.calculateShGrammar;
      if (isEmpty(grammar)) {
        continue
      }
      if (grammar.indexOf("hintError") >= 0) {
        detailList[i].hintError = "";
      }

      grammar = grammar.replaceAll("targetItem[.]", "detailList[i].targetItem.");
      // grammar = grammar.replaceAll("projectInfo[.]", "projectInfo.");
      // grammar = grammar.replace(/progressItem./g, "");
      grammar = grammar.replaceAll("hintError", "detailList[i].hintError");
      grammar = grammar.replaceAll("detail[.]", "detailList[i].");

      //创建接收的值
      //计算方案阶段的
      let grammar1 = grammar.replaceAll("input", "Number(detailList[i].shenHuaJieDuan)");
      grammar1 = grammar1.replaceAll("status", "detailList[i].shenHuaJieDuanStatus");

      // console.log(grammar1)
      if (!isEmpty(detailList[i].shenHuaJieDuan) || detailList[i].targetItem.writeShType === 2) {
        eval(grammar1);
      }
      // }
    }
    // //为空不判断
    // if (
    //   detailList[i].targetItem.checkTargetShRule == 3
    //   || detailList[i].targetItem.checkTargetShRule == 6
    //   || detailList[i].targetItem.checkTargetShRule == 10
    // ) {//这些规则需要等待两个框都填写
    // } else {//需要单独判断的填框，如果为空的话则不设置状态
    //   if (isEmpty(detailList[i].shenHuaJieDuan)) {
    //     detailList[i].shenHuaJieDuanStatus = 0;
    //   }
    // }

  }
}


/**处理施工的规则*/
export function dealSGRule(detailList, projectInfo) {
  if (detailList == null) {
    return
  }
  //计算所有的用地强度
  for (let i = 0; i < detailList.length; i++) {
    // detailList[i].hintError = "";
    //为空不判断、除开不能填写的项
    if (isEmpty(detailList[i].shiGongJieDuan) && detailList[i].targetItem.writeSgType != 2) {
      detailList[i].shiGongJieDuanStatus = 0;
      continue
    }

    // if (
    //   detailList[i].targetItem.checkTargetSgRule == 3
    //   || detailList[i].targetItem.checkTargetSgRule == 6
    //   || detailList[i].targetItem.checkTargetSgRule == 10
    // ) {//这些规则需要等待两个框都填写
    //   if (isEmpty(detailList[i].shenHuaJieDuan)
    //     || isEmpty(detailList[i].shiGongJieDuan)) {
    //     detailList[i].shenHuaJieDuanStatus = 0;
    //     detailList[i].shiGongJieDuanStatus = 0;
    //     continue;
    //   }
    // }

    if (detailList[i].targetItem.checkTargetSgRule == 0) {//不计算
      detailList[i].shiGongJieDuanStatus = 0;
      continue;
    } else if (detailList[i].targetItem.checkTargetSgRule == 1) {//小余等于
      if (Number(detailList[i].shiGongJieDuan)
        <= Number(detailList[i].targetItem.checkTargetRuleSgValue)) {
        detailList[i].shiGongJieDuanStatus = 0;
      } else {
        detailList[i].shiGongJieDuanStatus = 1;
      }
      if (Number(detailList[i].shiCeJieDuan)
        <= Number(detailList[i].targetItem.checkTargetRuleSgValue)) {
        detailList[i].shiCeJieDuanStatus = 0;
      } else {
        detailList[i].shiCeJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetSgRule == 2) {//小余
      if (Number(detailList[i].shiGongJieDuan)
        < Number(detailList[i].targetItem.checkTargetRuleSgValue)) {
        detailList[i].shiGongJieDuanStatus = 0;
      } else {
        detailList[i].shiGongJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetSgRule == 3) {//相同
      if (Number(detailList[i].shiGongJieDuan)
        === Number(detailList[i].targetItem.checkTargetRuleSgValue)) {
        detailList[i].shiGongJieDuanStatus = 0;
      } else {
        detailList[i].shiGongJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetSgRule == 4) {//大于
      if (Number(detailList[i].shiGongJieDuan)
        > Number(detailList[i].targetItem.checkTargetRuleSgValue)) {
        detailList[i].shiGongJieDuanStatus = 0;
      } else {
        detailList[i].shiGongJieDuanStatus = 1;
      }
    } else if (detailList[i].targetItem.checkTargetSgRule == 5) {//大于等于
      if (Number(detailList[i].shiGongJieDuan)
        >= Number(detailList[i].targetItem.checkTargetRuleSgValue)) {
        detailList[i].shiGongJieDuanStatus = 0;
      } else {
        detailList[i].shiGongJieDuanStatus = 1;
      }
    }
    // else if (detailList[i].targetItem.checkTargetSgRule == 6) {//误差小于等于 误差(绝对值)小于等于（施工图阶段-方案阶段）
    //   if (Math.abs((Number(detailList[i].shiGongJieDuan) - detailList[i].shenHuaJieDuan)
    //     / detailList[i].shenHuaJieDuan)
    //     <= Number(detailList[i].targetItem.checkTargetRuleSgValue)) {
    //     detailList[i].shenHuaJieDuanStatus = 0;
    //     detailList[i].shiGongJieDuanStatus = 0;
    //   } else {
    //     detailList[i].shenHuaJieDuanStatus = 0;
    //     detailList[i].shiGongJieDuanStatus = 1;
    //   }
    //   if (Math.abs((detailList[i].shiCeJieDuan - Number(detailList[i].shiGongJieDuan))
    //     / detailList[i].fangAnJieDuan)
    //     <= Number(detailList[i].targetItem.checkTargetRuleSgValue)) {
    //     detailList[i].shiCeJieDuanStatus = 0;
    //   } else {
    //     detailList[i].shiCeJieDuanStatus = 1;
    //   }
    // }
    // else if (detailList[i].targetItem.checkTargetSgRule == 10) {//单纯正偏差 正偏差=（（施工图阶段-方案阶段）/方案阶段）<x%并且 施工图阶段-方案阶段>=0
    //   if (!isEmpty(detailList[i].fangAnJieDuan)) {
    //     let piancha = ((Number(detailList[i].shiGongJieDuan) - detailList[i].fangAnJieDuan)
    //       / detailList[i].fangAnJieDuan);
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleSgValue)
    //       &&
    //       Number(detailList[i].shiGongJieDuan) - detailList[i].fangAnJieDuan >= 0) {
    //
    //       detailList[i].shiGongJieDuanStatus = 0;
    //     } else {
    //       detailList[i].shiGongJieDuanStatus = 1;
    //     }
    //   }
    // }
    else if (detailList[i].targetItem.checkTargetSgRule == 11) {//范围值
      // 先提取范围
      let value = detailList[i].targetItem.checkTargetRuleSgValue;
      let valueArr = value.split("-");
      let value1 = valueArr[0], value2 = valueArr[1];

      if (Number(detailList[i].shiGongJieDuan)
        >= value1
        && Number(detailList[i].shiGongJieDuan)
        <= value2) {
        detailList[i].shiGongJieDuanStatus = 0;
      } else {
        detailList[i].shiGongJieDuanStatus = 1;
      }
    }
    // else if (detailList[i].targetItem.checkTargetSgRule == 12) {//百分比偏差=（（施工图阶段-方案阶段）/方案阶段） 施工图阶段可以小于方案阶段的值
    //
    //   if (!isEmpty(detailList[i].fangAnJieDuan)) {
    //     let piancha = ((Number(detailList[i].shiGongJieDuan) - detailList[i].fangAnJieDuan)
    //       / detailList[i].fangAnJieDuan).toFixed(8);
    //     piancha = Math.abs(piancha)
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleSgValue)
    //     ) {
    //
    //       // detailList[i].shenHuaJieDuanStatus = 0;//施工就只管施工的状态不然多状态下会冲突的
    //       detailList[i].shiGongJieDuanStatus = 0;
    //     } else {
    //       // detailList[i].shenHuaJieDuanStatus = 1;
    //       detailList[i].shiGongJieDuanStatus = 1;
    //     }
    //   }
    // } else if (detailList[i].targetItem.checkTargetSgRule == 13) {//值偏差=（（施工图阶段-方案阶段）<x） 施工图阶段可以小于方案阶段的值
    //
    //   if (!isEmpty(detailList[i].fangAnJieDuan)) {
    //     let piancha = (Number(detailList[i].shiGongJieDuan) - detailList[i].fangAnJieDuan)
    //     piancha = Math.abs(piancha)
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleSgValue)
    //     ) {
    //
    //       // detailList[i].shenHuaJieDuanStatus = 0;//施工就只管施工的状态不然多状态下会冲突的
    //       detailList[i].shiGongJieDuanStatus = 0;
    //     } else {
    //       // detailList[i].shenHuaJieDuanStatus = 1;
    //       detailList[i].shiGongJieDuanStatus = 1;
    //     }
    //   }
    // } else if (detailList[i].targetItem.checkTargetSgRule == 14) {//值负偏差 ： 偏差值=（（（施工图阶段-方案阶段）/方案阶段）） 并且  施工图阶段可以小于方案阶段的值,但是施工大于方案的话偏差不能超过x%
    //   if (!isEmpty(detailList[i].fangAnJieDuan)) {
    //     let piancha = (Number(detailList[i].shiGongJieDuan) - detailList[i].fangAnJieDuan) / detailList[i].fangAnJieDuan
    //     console.log(piancha)
    //     if (piancha
    //       <= Number(detailList[i].targetItem.checkTargetRuleSgValue)
    //     ) {
    //       detailList[i].shiGongJieDuanStatus = 0;
    //     } else {
    //       detailList[i].shiGongJieDuanStatus = 1;
    //     }
    //   }
    // }
    else if (detailList[i].targetItem.checkTargetSgRule == 100) {//直接执行语句
      // if (detailList[i].targetItem.title3.indexOf("砌体指标（11层以下）") >= 0) {
      //替换信息
      let grammar = detailList[i].targetItem.calculateSgGrammar;
      if (isEmpty(grammar)) {
        continue
      }
      if (grammar.indexOf("hintError") >= 0) {
        detailList[i].hintError = "";
      }

      grammar = grammar.replaceAll("targetItem[.]", "detailList[i].targetItem.");
      // grammar = grammar.replaceAll("projectInfo[.]", "projectInfo.");
      grammar = grammar.replaceAll("hintError", "detailList[i].hintError");
      grammar = grammar.replaceAll("detail[.]", "detailList[i].");

      //创建接收的值
      //计算施工阶段状态
      let grammar2 = grammar.replaceAll("input", "Number(detailList[i].shiGongJieDuan)");
      grammar2 = grammar2.replaceAll("status", "detailList[i].shiGongJieDuanStatus");

      // console.log(grammar2)
      if (!isEmpty(detailList[i].shiGongJieDuan) || detailList[i].targetItem.writeSgType === 2) {
        eval(grammar2);
      }
      // }


    }
    // //为空不判断
    // if (
    //   detailList[i].targetItem.checkTargetSgRule == 3
    //   || detailList[i].targetItem.checkTargetSgRule == 6
    //   || detailList[i].targetItem.checkTargetSgRule == 10
    // ) {//这些规则需要等待两个框都填写
    // } else {//需要单独判断的填框，如果为空的话则不设置状态
    //   if (isEmpty(detailList[i].shiGongJieDuan)) {
    //     detailList[i].shiGongJieDuanStatus = 0;
    //   }
    // }

  }


}


